trigger trg_do_not_delete_parent_children on Parent__c (before delete) {
    List<Parent__c> incomingParents = Trigger.OLD;
    
    /*
    // 100 SOQL RUNS
    for(Parent__c p: incomingParents){
        Integer childCount = [SELECT COUNT() FROM Child__c where Parent__c = :p.Id];
        if(childCount > 0){
             p.addError('Sorry! Record has child items and can not be deleted.');   
        }
    }
    */
    for(Child__c c : [SELECT Parent__c FROM Child__c  WHERE Parent__c IN :Trigger.oldMap.keySet()]) {        			
         Trigger.oldMap.get(c.Parent__c).addError('Sorry! Record has child items and can not be deleted.');    
    }
}